package FightLandlords;

import domain.User;

import java.io.*;
import java.util.ArrayList;

public class Test {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        User user1 = new User("user1","12345678l");
        User user2 = new User("user2","12345678l");
        User user3 = new User("user3","12345678l");

        ArrayList<User> list1 = new ArrayList<>();
        list1.add(user1);
        list1.add(user2);
        list1.add(user3);
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("E:\\practice-start\\java-test\\Fight\\FightLord\\src\\FightLandlords\\Users.data"));
        oos.writeObject(list1);
        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("E:\\practice-start\\java-test\\Fight\\FightLord\\src\\FightLandlords\\Users.data"));
        ArrayList<User> list2 = (ArrayList<User>) ois.readObject();
        System.out.println(list2);


    }

}
